﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;

namespace MDF.Worker
{
    public class WorkerManager
    {

        private List<IWorker> m_lstWorker = new List<IWorker>();

        public void Add(IWorker _thread)
        {
            m_lstWorker.Add(_thread);
        }

        public void Run()
        {
            for (int i = 0; i < m_lstWorker.Count; i++)
            {
                m_lstWorker[i].ThreadToRun.IsBackground = true;
                m_lstWorker[i].ThreadToRun.Start();
            }
            foreach (var thread in m_lstWorker)
                thread.ThreadToRun.Join();
        }

    }
}
